package com.wj.rpsm.user.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

/**
 * @author WeiJin
 * @version 1.0
 */
public class DateUtil {
    private DateUtil() {
    }

    public static LocalDateTime getNowTime() {
        String format = LocalDateTime.now(ZoneId.of("Asia/Shanghai"))
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        return LocalDateTime.parse(format, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
    }

    public static LocalDate getNowDate() {
        String format = LocalDate.now(ZoneId.of("Asia/Shanghai"))
                .format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        return LocalDate.parse(format, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
    }
}
